home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / source / dr2d.lha / iffpobj2d.h < prev    next >
C/C++ Source or Header  |  1991-11-20  |  4KB  |  186 lines

  1. #ifndef IFFP_OBJ2D_H
  2. #    define    IFFP_OBJ2D_H
  3.  
  4. /* This header file defines the structure of a display
  5.  * list; that is, a list of objects to be read from a file,
  6.  * displayed, modified, and written back to a file.
  7.  *
  8.  * Ross Cunniff, Stylus, Inc. 9/21/91
  9.  */
  10.  
  11. #ifndef IFFP_IFF_H
  12. #    include    "iffp/iff.h"
  13. #endif
  14.  
  15. #ifndef IFFP_DR2D_H
  16. #    include    "iffp/dr2d.h"
  17. #endif
  18.  
  19. /* Type of a coordinate, either a floating point number or a
  20.  * scaled integer.  See also ieee2flt and flt2ieee.
  21.  */
  22.  
  23. #ifdef    FLT_COORD
  24. #    define    FLT_IND        DR2D_IND
  25.     typedef float Coord;
  26. #else
  27. #    define    FIXOFFS    10        /* Power of 2 to multiply by */
  28. #    define    FLT_IND        0x80000000
  29.     typedef long Coord;
  30. #endif
  31.  
  32.  
  33. /* Everything necessary to display a list of objects */
  34.  
  35. struct Proj2D {
  36.     Coord
  37.     UL_X, UL_Y,    /* Upper left corner of display */
  38.     LR_X, LR_Y;    /* Lower right corner of display */
  39.  
  40.     struct FONSstruct
  41.     *FontTable;    /* List of fonts used */
  42.     char
  43.     **FontNames;    /* Names of the fonts */
  44.     int
  45.     MaxFont,    /* Allocated size of above table */
  46.     NumFont;    /* Actual size of the above table */
  47.  
  48.     int
  49.     *DashCounts;    /* List of line patterns used */
  50.     Coord
  51.     **DashPatts;
  52.     int
  53.     MaxDash,    /* Allocated size of above table */
  54.     NumDash;    /* Actual size of the above table */
  55.  
  56.     UBYTE
  57.     *RGB_Table,    /* List of RGB colors used */
  58.     *CMYK_Table;    /* List of CMYK colors used */
  59.     char
  60.     **CNAM_Table;    /* List of color names used */
  61.     int
  62.     NumColor;    /* Size of the above 3 tables */
  63.  
  64.     struct Obj2D
  65.     **FillTable;    /* List of object-oriented fill patterns */
  66.     int
  67.     MaxFills,    /* Allocated size of above table */
  68.     NumFills;    /* Actual size of the above table */
  69.  
  70.     struct LAYRstruct
  71.     *LayerTable;    /* List of layer attributes */
  72.     struct Obj2D
  73.     **Objects,    /* List of objects in each layer */
  74.     **LastObjs;    /* Tail of each list */
  75.     int
  76.     MaxLayer,    /* Allocated size of above table */
  77.     NumLayer;    /* Actual size of above table */
  78. };
  79.  
  80. /* A single object (or one of a list of objects) */
  81. struct Obj2D {
  82.  
  83.     struct Obj2D
  84.     *Next;        /* Next object in a list of objects */
  85.  
  86.     ULONG
  87.     Type;        /* One of CPLY, OPLY, STXT, TPTH, XTRN, GRUP, VBM */
  88.  
  89.     struct ATTRstruct
  90.     Attrs;        /* Fill, join, etc. */
  91.  
  92.     Coord
  93.     XMin, YMin,    /* Bounding box of object */
  94.     XMax, YMax;
  95.  
  96.     union {
  97.  
  98.     /* Data if a CPLY or OPLY */
  99.     struct {
  100.         USHORT
  101.         NumPoints;    /* Size of polygon */
  102.         Coord
  103.         *Coords;    /* Coordinates of polygon */
  104.     }   POLYdata;
  105.  
  106.     /* Data if a TPTH */
  107.     struct {
  108.         USHORT
  109.         WhichFont;    /* Which font to display string with */
  110.         Coord
  111.         Width, Height;    /* Size of an individual char */
  112.         USHORT
  113.         NumChars;    /* Length of string */
  114.         char
  115.         *String;    /* String to display */
  116.         short
  117.         NumPath;    /* Length of path */
  118.         Coord
  119.         *Path;        /* Path along which to display */
  120.     }   TPTHdata;
  121.  
  122.     /* Data if an STXT */
  123.     struct {
  124.         USHORT
  125.         WhichFont;    /* Which font to display string with */
  126.         Coord
  127.         XPos, YPos,    /* Where to draw it */
  128.         Rotation,    /* How to rotate it */
  129.         Width, Height;    /* Size of an individual character */
  130.         USHORT
  131.         NumChars;    /* Number of characters in string */
  132.         char
  133.         *String;    /* String of characters */
  134.     }   STXTdata;
  135.  
  136.     /* Data if a GRUP */
  137.     struct {
  138.         USHORT
  139.         NumObjs;    /* # of objects in group */
  140.         struct Obj2D
  141.         *Objs,        /* List of objects in group */
  142.         *Tail;        /* Tail of the list */
  143.     }   GRUPdata;
  144.  
  145.     /* Data if an XTRN */
  146.     struct {
  147.         USHORT
  148.         ApplCallBacks,    /* X_* from dr2d.h */
  149.         ApplNameLength;    /* Length of the callback name */
  150.         char
  151.         *ApplName;    /* Name of the macro to call */
  152.         struct Obj2D
  153.         *Obj;        /* Object attached to the macro */
  154.     }   XTRNdata;
  155.  
  156.     /* Data if a VBM */
  157.     struct {
  158.         Coord
  159.         XPos, YPos,    /* Where the bitmap is to be displayed */
  160.         Width, Height,    /* How big to make it */
  161.         Rotation;    /* Angle to rotate it */
  162.         USHORT
  163.         PathLen;    /* Length of the filename */
  164.         char
  165.         *Path;        /* Filename where to find it */
  166.     }   VBMdata;
  167.  
  168.     }    Data;
  169. };
  170.  
  171. /* Definition of the dr2d reader and writer */
  172. extern int
  173.     ReadDR2D( struct ParseInfo *PI, long GotForm, struct Proj2D **Conts ),
  174.     WriteDR2D( struct ParseInfo *PI, struct Proj2D *Conts );
  175.  
  176. /* Definition of some utility routines */
  177. extern void
  178.     ieee2flt( IEEE *, Coord * ),
  179.     flt2ieee( Coord *, IEEE * ),
  180.     FreeObj( struct Obj2D * ),
  181.     FreConts( struct Proj2D * );
  182.  
  183. #endif    /* OBJ2D_H_INCLUDED */
  184.  
  185. /*** EOF obj2d.h ***/
  186.